import java.util.Scanner;

public class Main1390 {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int a=sc.nextInt();
        int x=a%10;//4
        int y=(a/10)%10;//3
        int z=(a/100)%10;//2
        int j=a/1000;//1
        int b=x+y+z+j;
        System.out.println(b);
    }
}
